/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-30 11:01:15
 * @Description  : 考试相关接口
 */

import type {
  ExamCreateReq,
  ExamPageRes,
  ExamReq,
  ExamUpdateReq
} from '@/types/exam'
import request from '@/utils/request'

// 分页查询考试接口
export const getExamByPage = (params?: ExamReq) => {
  return request.get<ExamPageRes>('/exam/list', { params })
}

// 分页查询考试接口
export const getAuthExamByPage = (params?: ExamReq) => {
  return request.get<ExamPageRes>('/exam/auth/list', { params })
}

// 添加考试接口
export const createExam = (data: ExamCreateReq) => {
  return request.post('/exam/create', data)
}

// 更新考试接口
export const updateExam = (data: ExamUpdateReq) => {
  return request.put('/exam/update', data)
}

// 考试排序接口
export const sortExam = (examIds: string[]) => {
  return request.put('/exam/sort', { examIds })
}

// 考试删除接口
export const delExam = (examIds: string[], picCode?: string) => {
  return request.delete('/exam/delete', { data: { examIds, picCode } })
}


// 根据id获取考试详情接口
export const getExamById = (examId: string) => {
  return request.get('/exam/info', { params: { examId } })
}
